package com.zjdiepu.www.commpent.mapper.cw;

import javax.annotation.Resource;

import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.stereotype.Component;

import com.zjdiepu.www.base.core.BaseMapper;
import com.zjdiepu.www.base.enums.type.DataDicType;
import com.zjdiepu.www.commpent.RedisObjectClient;
import com.zjdiepu.www.ibiz.cache.ICachedDictionaryService;
import com.zjdiepu.www.model.base.dto.SimpleDataDictionary;
import com.zjdiepu.www.model.cw.dto.CwRemitCar;
/**
 * 项目名称：diepu-parent-biz <br/> 
 * 类名称：CwRemitCarVoMapper <br/>  
 * 类描述：打提车款 <br/>    
 * 创建人：xiongxiaotun <br/> 
 * 创建时间：2017年5月24日 上午11:29:13  <br/>   
 * 修改人：xiongxiaotun <br/> 
 * 修改时间：2017年5月24日 上午11:29:13   <br/>  
 * 修改备注：    <br/> 
 * @version V1.0   <br/>
 */
@Component
public class CwRemitCarVoMapper extends BaseMapper<CwRemitCar>{
	@Resource
	private ICachedDictionaryService cachedDictionaryService;
	@Resource
	private RedisObjectClient redisObjectClient;
	@Override
	public void mapper(RedisConnection redisConnection,CwRemitCar m) {
		if(null == m) {
			return;
		}
		String fundChannel = m.getFundChannel();
		SimpleDataDictionary simpleDataDictionary1 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), fundChannel, DataDicType.FUND_CHANNEL.getCode());
		m.setFundChannelDisplay(simpleDataDictionary1 == null ? "" : simpleDataDictionary1.getName());
		
		String typeBalance = m.getTypeBalance();
		SimpleDataDictionary simpleDataDictionary2 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), typeBalance, DataDicType.SETTLEMENT_TYPE.getCode());
		m.setTypeBalanceDisplay(simpleDataDictionary2 == null ? "" : simpleDataDictionary2.getName());
		
		String bankRemit = m.getBankRemit();
		SimpleDataDictionary simpleDataDictionary3 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), bankRemit, DataDicType.REMIT_TYPE.getCode());
		m.setBankRemitDisplay(simpleDataDictionary3 == null ? "" : simpleDataDictionary3.getName());
		
		String nameAuditor = m.getNameAuditor();
		SimpleDataDictionary simpleDataDictionary4 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), nameAuditor, DataDicType.FINANCE_AUDITOR.getCode());
		m.setNameAuditorDisplay(simpleDataDictionary4 == null ? "" : simpleDataDictionary4.getName());
		
		//天津中转账号
		String ccol1 = m.getCcol1();
		SimpleDataDictionary simpleDataDictionary5 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), ccol1, DataDicType.TJ_TRANSFER_ACCNO.getCode());
		m.setCcol1Display(simpleDataDictionary5 == null ? "" : simpleDataDictionary5.getName());
	}
}
